package cn.wolfcode.plus.web.controller;

import cn.wolfcode.plus.domain.Employee;
import cn.wolfcode.plus.mapper.EmployeeMapper;
import cn.wolfcode.plus.service.IEmployeeService2;
import cn.wolfcode.plus.uilt.AjaxResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/employee")
public class EmployeeController {
    @Autowired
    private IEmployeeService2 employeeService2;
    //查询页面
    @GetMapping("/list")
    public List<Employee> list(){
        return employeeService2.list();
    }

    @PostMapping("/post")
    public AjaxResult post(Employee employee){
        employeeService2.save(employee);
        return AjaxResult.success();
    }

    @PutMapping("/put")
    public AjaxResult put(Employee employeee){
        employeeService2.updateById(employeee);
        return AjaxResult.success();
    }
    @GetMapping("/getOne")
    public Employee getOne(Long id){
        return employeeService2.getById(id);
    }
}
